package cn.kgc.web;

import cn.kgc.entity.Product;
import cn.kgc.service.ProductService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/product")
public class ProductController {

    @Autowired
    private ProductService productService;

    @GetMapping("/list")
    public PageInfo<Product> showProductList(@RequestParam String productName,
                                              @RequestParam(defaultValue = "1") Integer pageId){
         return productService.queryProductList(productName,pageId);
    }

}
